package CrowdCounting.RunnableTask.CrowdCountingTask;

import Const.State;
import CrowdCounting.Model.CrowdCounting.CrowdCountingShow;
import CrowdCounting.Model.Util;
import CrowdCounting.RunnableTask.ShowLabelTask;

public abstract class CCShowLabelTask extends ShowLabelTask {
    @Override
    public void run() {
        showLabelRunAndRurn();
    }

    protected void showLabelRunAndRurn() {
        while (true) {
            while (CrowdCountingShow.getShowLabelThreadState() == State.START) {
                showLabel();
            }
            if (CrowdCountingShow.getShowLabelThreadState() == State.CLOSE) {
                System.out.println("已关闭");
                break;
            }
            if (CrowdCountingShow.getShowLabelThreadState() == State.STOP) {
                System.out.println("暂停中");
                Util.sleepTime(1000);
            }
        }
    }

    public abstract void showLabel();
}
